<?php

class Default_Model_Holder extends Zend_Db_Table_Abstract
{
    protected $_name = 'holder';
    public function getDataByName($name)
    {
    	$query = $this->select();
        $query->from($this->_name,array('holderId', 'holderName'));
        $query->where('holderName = ?', $name);
        return $this->fetchRow($query);
    }
    public function getDataById($id)
    {
    	$query = $this->select();
        $query->from($this->_name,array('holderId', 'holderName'));
        $query->where('holderId = ?', $id);
        return $this->fetchRow($query);
    }
    public function getAllData()
    {
		$select = $this->select();
   		$select->from(array('h'=>'holder'));

   		return $this->fetchAll($select);
    }
    public function deleteData ($id)
    {
        $this->delete( 'holderId = ' . (int) $id );
    }
    public function addData ($name)
    {
        $data = array ('holderName' => $name);
        return $this->insert( $data );
    }
}

